import http from "../utils/request"
// 获取验证码
export let getCaptchaApi =()=>http.get("/users/getCaptcha?v=next")
// 校验验证码
export let verifyCaptchaApi =captcha=>http.get("/users/verifyCaptcha?captcha="+captcha)
// 用户名密码登录
export let loginApi = (username,password) =>http.post("/users/login",{
    username,
    password
})
// 获取手机验证码
export let getSmsCodeApi = phoneNumber =>http.post('/sms/send',{phoneNumber})
// 手机验证码登录
export let smsApi = code =>http.post('/users/login?type=sms',{code})
// 获取登录日志
// export let getloginlogApi = (page=1,count=10)=>http.get("/getloginlog",{
//     headers:{
//         'authorization':sessionStorage.getItem('my-token')
//     }
// })
export let getLoginLogApi = (page = 1, count = 10) => http.get(`/getloginlog?page=${page}&count=${count}`)
// 获取所有用户
export let getAllUsersApi =()=>http.get('/users/getAllUsers')
// 添加用户
export let addUserApi=(username,password,nickname)=>http.post("/users/addUser",{
    username,
    password,
    nickname
})
// 修改用户信息
export const updateUserApi = unid =>http.post("/users/updateUser",unid)